<?php

class MineBurstAction extends SzAbstractAction
{
    Protected $paramTypes = array(
        SzAbstractAction::TYPE_INT,
        SzAbstractAction::TYPE_STRING,
        SzAbstractAction::TYPE_INT,
        SzAbstractAction::TYPE_STRING,
        SzAbstractAction::TYPE_INT,
    );

    /**
     * 炸矿
     * @param $userId
     * @param $gridId
     * @param $gridLayer
     * @param $requireId
     * @param $reqTime
     * @return SzResponse
     */
    public function execute($userId, $gridId, $gridLayer, $requireId, $reqTime)
    {
        if (!GameService::get()->verifySysUnlock($userId, GameConst::FUNC_MINE_FUNC)) {
            return $this->buildResponse(false);
        }

        GameService::get()->validateMultiRequestTimeDelta($userId, $reqTime);

        $mine = MineService::get()->mine($userId, $gridId, $gridLayer, $requireId);
        return $this->buildResponse(
            $mine->toArray()
        );
    }
}